<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>盒模型</title>
    <style type="text/css">
        #div1 {
            width: 100px;
            padding: 10px;
            border: 1px solid #ccc;
            margin: 10px;
            box-sizing: border-box;
        }
    </style>
</head>
<body>
    <div id="div1">
        this is div1
    </div>

    <script>
        // document.getElementById('div1').offsetWidth
    </script>
</body>
</html>